import { Component, Input, OnInit,AfterViewInit, ViewChild,ElementRef } from '@angular/core';

@Component({
  selector: 'nova-edit-button',
  templateUrl: './edit-button.component.html',
  styleUrls: ['./edit-button.component.css']
})
export class EditButtonComponent {
  @ViewChild("novaButton")
  buttonComp!:ElementRef 
   
  @Input("colorn") colorn:any
  @Input("labe") labe:any
  constructor(){
    
  }
  ngAfterViewInit(): void {
    console.log(this.colorn)
    let buttonEl = this.buttonComp.nativeElement 
    if(buttonEl){
      switch (this.colorn) {
        case "primary":
          // 蓝色
          buttonEl.style.backgroundColor = "#00a8f3"
          buttonEl.style.color = "black"
          break;
        case "warn":
          // 黄色
          buttonEl.style.backgroundColor = "#ffca18"
          buttonEl.style.color = "black"
          break;
        case "danger":
          // 红色
          buttonEl.style.backgroundColor = "#ec1c24"
          buttonEl.style.color = "black"
          break;
          // 绿色
          case "success":
          buttonEl.style.backgroundColor = "#0ed145"
          buttonEl.style.color = "black"
          break;
          // 青色
          case "info":
          buttonEl.style.backgroundColor = "#7dec1c"
          buttonEl.style.color = "black"
          break;
          // 灰色
          case "derk":
          buttonEl.style.backgroundColor = "#c3c3c3"
          buttonEl.style.color = "black"
          break;
        default:
          break;
      }
    }
  }
}

